<h1>Listing books</h1>

<table>
  <tr>
    <th>Title</th>
    <th>Price</th>
    <th>ISBN</th>
    <!--<th>Description</th>-->
    <th></th>
    <th></th>
    <th></th>
  </tr>

<% @books.each do |book| %>
  <tr>
    <td><% if Collection.find_by_id(book.collection_id) %>
    	<%=	Collection.find_by_id(book.collection_id).title %>   
    	<%	else %>
    	<%= "Unknown"%>
    	<% end %>
    	<%= book.title %></td>
    <td><%= book.price %> <% if book.price %>€<% end %></td>
    <td><%= book.isbn %></td>
    <td><%#= book.description %></td>
    <td><%= link_to 'Show', book %></td>
    <% if @user && @user.admin? %>
    <td><%= link_to 'Edit', edit_book_path(book)  %></td>
    <td><%= link_to 'Destroy', book, :method => :delete, :data => { :confirm => 'Are you sure?' } %></td>
    <% end %>
  </tr>
<% end %>
</table>

<br />

<%= link_to 'New Book', new_book_path %>
